package jsu.lipengcheng.trafficnet.controlle.admin;

import jsu.lipengcheng.trafficnet.common.Adminlogin;
import jsu.lipengcheng.trafficnet.common.Result;
import jsu.lipengcheng.trafficnet.pojo.Admins;
import jsu.lipengcheng.trafficnet.pojo.Users;
import jsu.lipengcheng.trafficnet.service.AdminService;
import jsu.lipengcheng.trafficnet.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.kafka.KafkaProperties;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/admin")
public class AdminControlle {
    @Autowired
    private AdminService adminService;
    @Autowired
    private UserService userService;
   @PostMapping("login")
    public Result login(@RequestBody Admins admins) {
       Adminlogin adminlogin= adminService.login(admins);
       return Result.success(adminlogin);
   }

    /**
     * 查询所有用户
     * @return
     */
    @GetMapping("/userall")
    public Result selectalluser(){
        List<Users> usersList= userService.selectalluser();
        return Result.success(usersList);
    }

}
